02. (OPTIONAL) One Perk of Using Atom
(OPTIONAL) One Perk of Using Atom — Previewing HTML
Normally, you’ll be writing code in a text editor, saving it as an HTML file, and opening that file in a browser to view the rendered web page. One convenience with using Atom as a text editor is that you can write your HTML code and also preview the web page right inside the editor as you make changes. You can split your window to see both views simultaneously, as shown below.
In Atom, you can edit HTML and preview the resulting web page in a split window.
On the left, we see our HTML code, and on the right, we see a preview of the web page.
We'll show several code examples in this fashion throughout the rest of the lesson.
Installing the atom-html-preview package
If you’d like to set up your Atom workspace this way, you can go through the following steps to install what’s called the atom-html-preview package. Otherwise, feel free to skip these instructions and just use your browser to view your HTML documents.
On Mac:
First, you’ll need to install the package:
- Open Atom. In the menu bar along the top of the window, select
Atom→Preferences. - Select
Install. - In the search field, type
atom-html-preview, and hit theRETURNkey on your keyboard. You should see the package appear with an option toInstallit. - Click
Install. - Once the package installation is complete, exit
Preferences.
To see a preview of your HTML, follow these steps:
- Open your HTML file.
- Preview your HTML by typing on the keyboard:
control+shift+H
You should now see your screen split into left and right panes, with the HTML preview displayed on the right.
Note that, in general, you can split your screen into panes by going to the menu bar, selecting View → Panes, and choosing, for example, Split Right. Once you’ve split your screen, you can hover over the divider, click, and drag to adjust the pane width.
On Windows:
First, you’ll need to install the package:
- Open Atom. In the menu bar along the top of the window, select
File→Settings. (Note: If you don’t see a menu bar for some reason, hit thealtkey on your keyboard to make it visible.) - Select
Install. - In the search field, type
atom-html-preview, and hitENTER. You should see the package appear with an option toInstallit. - Click
Install. - Once the package installation is complete, exit
Settings.
To see a preview of your HTML, follow these steps:
- Open your HTML file.
- Preview your HTML by typing on the keyboard:
Ctrl+Shift+H
You should now see your screen split into left and right panes, with the HTML preview displayed on the right.
Note that, in general, you can split your screen into panes by going to the menu bar, selecting View → Panes, and choosing, for example, Split Right. Once you’ve split your screen, you can hover over the divider, click, and drag to adjust the pane width.